
package com.yadong.smarthome2.protocol2.wificlient;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.util.Log;

public class NetStatusReceiver extends BroadcastReceiver {
    private static final String TAG = "BroadcastReceiver";

    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        if (Intent.ACTION_BOOT_COMPLETED.equals(action)
                || ConnectivityManager.CONNECTIVITY_ACTION.equals(action)) {
            boolean wifiConnected = Utils.getWifiConnectedStatus(context);
            Log.d(TAG, "on receive boradcast action = " + action + " wifi connected:"
                    + wifiConnected);
            Intent serviceIntent = null;
            if (wifiConnected) {
                // Start Service now
            } else {
            }
            context.startService(serviceIntent);
        }
    }
}
